import request from '@/utils/request'

// 学生相关API接口
const StudentAPI = {
  // 示例方法
  getExamList() {
    return request({
      url: '/student/exams',
      method: 'get'
    })
  },

  // 获取老师列表
  getTeacherList(params) {
    return request({
      url: '/student/getTeacherList',
      method: 'get',
      params: params
    })
  },

  // 选择老师
  chooseTeacher(teacherId) {
    return request({
      url: `/student/chooseTeacher/${teacherId}`,
      method: 'post'
    })
  },

  // 获取已选择的老师id列表
  getChosenTeacherIds() {
    return request({
      url: '/student/getChosenTeacherIds',
      method: 'get'
    })
  },

  // 获取考试记录
  getExamRecords(examTime) {
    return request({
      url: '/student/getExamRecords',
      method: 'get',
      params: {
        startTime: examTime.startTime,
        endTime: examTime.endTime
      }
    })
  },

  // 获取成绩列表
  getScores() {
    return request({
      url: '/student/getScores',
      method: 'get'
    })
  },

  // 获取未参加的考试列表
  getNoExamList(subjectName) {
    return request({
      url: '/student/noExamList',
      method: 'get',
      params: {
        subjectName: subjectName
      }
    })
  },

  // 参加考试
  takeExam(subjectId) {
    return request({
      url: `/student/takeExam/${subjectId}`,
      method: 'post'
    })
  },

  // 获取考试试卷
  getExam(subjectId) {
    return request({
      url: `/student/getExam/${subjectId}`,
      method: 'get'
    })
  },

  // 保存答案
  saveAnswer(answer) {
    return request({
      url: '/student/saveAnswer',
      method: 'post',
      data: answer
    })
  },

  // 提交试卷
  submitExam(subjectId) {
    return request({
      url: `/student/submitExam/${subjectId}`,
      method: 'post'
    })
  },

  // 错题分析
  analyzeQuestion(answerDetail) {
    return request({
      url: '/student/analyze',
      method: 'get',
      params: answerDetail
    })
  },

  // 生成智能报告
  generateReport(correctExam) {
    return request({
      url: '/student/generateReport',
      method: 'get',
      params: correctExam
    })
  },

  // 获取正在进行的考试
  getExamings() {
    return request({
      url: '/student/getExamings',
      method: 'get'
    })
  }
}

export default StudentAPI